home *** CD-ROM | disk | FTP | other *** search
- /*
- cvplatfm.cpp
-
- List of platforms window
-
- C++/Views 2.0 Demo
- Copyright (c) 1992, by Liant Software Corp.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 10/12/92 jmd changed radio buttons to list box
- */
-
- #include "cvplatfm.h"
- #include "cvdemovw.h"
- #include "brush.h"
- #include "font.h"
- #include "listbox.h"
- #include "editbox.h"
- #include "messengr.h"
-
- defineClass(PlatformView, VMdiView)
-
- char *platBttns[] = { "MS Windows", "OS/2 PM", "Motif", "Others", 0 };
-
- PlatformView::PlatformView()
- {
- ;
- }
-
- PlatformView::PlatformView(VFrame &f, DemoAppView *parent)
- : VMdiView("PlatformIcon", f, (VWindow *) parent, StyleBorder | StyleTitle | StyleCloseBox | StyleSizable)
- {
- mainWin = parent;
- platform = 0;
-
- setTitle("C++/Views Supported Platforms");
-
- msgFont = new VFont("Arial", 10);
- listFont = new VFont("Arial", 14);
-
- /* create an edit box to display message in */
- msgBox = new VEditBox(VFrame(0.05F, 0.5F, 0.9F, 0.35F), this,
- StyleBorder | StyleVertical | StyleWordWrap | StyleReadOnly);
-
- msgBox->setFont(msgFont);
- msgBox->putText(cvTextFile->getMessage("Platform:Windows").gets());
-
- /* create a list box */
- VListBox *listBox;
- listBox = new VListBox(VFrame(0.05F, 0.05F, 0.9F, 0.4F), this, StyleBorder);
- listBox->uponClick(this, methodOf(PlatformView, singleClick),
- methodOf(PlatformView, doubleClick));
-
- listBox->setFont(listFont);
-
- /* put entries into list box */
- listBox->appendString("MS Windows");
- listBox->appendString("OS/2 PM");
- listBox->appendString("Motif");
- listBox->appendString("Others");
-
- /* make sure the "About this Window" data is set up */
- mainWin->setAboutNames("Platform:About", "cvplatfm.cpp");
- }
-
- PlatformView::~PlatformView()
- {
- /* destroy background brush (if present) */
- delete getBackground();
-
- delete listFont;
- delete msgFont;
- }
-
- boolean PlatformView::free()
- {
- delete this;
- return(TRUE);
- }
-
- boolean PlatformView::close()
- /*
- The user has closed the window.
- Notify the main window so that it can update the main menu bar
- */
- {
- mainWin->platformView = 0;
- mainWin->updateMenu();
- return(FALSE);
- }
-
- boolean PlatformView::singleClick(int index)
- /*
- Mouse clicked in list box.
- */
- {
- platform = index;
-
- switch(platform) {
- case 0:
- msgBox->putText(cvTextFile->getMessage("Platform:Windows").gets());
- break;
- case 1:
- msgBox->putText(cvTextFile->getMessage("Platform:PM").gets());
- break;
- case 2:
- msgBox->putText(cvTextFile->getMessage("Platform:Motif").gets());
- break;
- case 3:
- msgBox->putText(cvTextFile->getMessage("Platform:Others").gets());
- break;
- }
-
- return(TRUE);
- }
-
- boolean PlatformView::doubleClick(int index)
- /*
- Mouse double-clicked in list box.
- */
- {
- return(TRUE);
- }
-
- boolean PlatformView::givenFocus()
- /*
- Our window has just been given input focus
- */
- {
- /* set the data for the About this Window dialog */
- mainWin->setAboutNames("Platform:About", "cvplatfm.cpp");
-
- /* carry on with default window behavior, return FALSE */
- return(FALSE);
- }
-